﻿<Window
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d" 
        x:Class="LASDesktop.ModuloCompras.ModuloCompras"
        Title="Compras y Ventas" Height="700" Width="1047" Background="#FFBCBCBC" WindowStartupLocation="CenterScreen" Foreground="#FFBCBCBC" Closing="CloseParent">
    <Window.Resources>
        <Style TargetType="{x:Type Button}">
            <Setter Property="SnapsToDevicePixels" Value="true"/>
            <Setter Property="OverridesDefaultStyle" Value="true"/>
            <Setter Property="MinHeight" Value="23"/>
            <Setter Property="MinWidth" Value="75"/>
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="{x:Type Button}">
                        <Border 
			        x:Name="Border"  
			        CornerRadius="2" 
			        BorderThickness="1"
			        Background="#FF0384C5"
			        BorderBrush="#FF0384C5">
                            <ContentPresenter 
			          Margin="2"
			          HorizontalAlignment="Center"
			          VerticalAlignment="Center"
			          RecognizesAccessKey="True"/>
                        </Border>
                        <ControlTemplate.Triggers>
                            <Trigger Property="IsKeyboardFocused" Value="true">
                                <Setter TargetName="Border" Property="BorderBrush" Value="#FF0384C5" />
                            </Trigger>
                            <Trigger Property="IsDefaulted" Value="true">
                                <Setter TargetName="Border" Property="BorderBrush" Value="#FF0384C5" />
                            </Trigger>
                            <Trigger Property="IsMouseOver" Value="true">
                                <Setter TargetName="Border" Property="Background" Value="#FF0384C5" />
                            </Trigger>
                            <Trigger Property="IsPressed" Value="true">
                                <Setter TargetName="Border" Property="Background" Value="#FF0384C5" />
                                <Setter TargetName="Border" Property="BorderBrush" Value="#FF0384C5" />
                            </Trigger>
                            <Trigger Property="IsEnabled" Value="false">
                                <Setter TargetName="Border" Property="Background" Value="#FF0384C5" />
                                <Setter TargetName="Border" Property="BorderBrush" Value="#FF0384C5" />
                                <Setter Property="Foreground" Value="#888888"/>
                            </Trigger>
                        </ControlTemplate.Triggers>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>
        <Style TargetType="{x:Type TabItem}">
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="{x:Type TabItem}">
                        <Grid>
                            <Border x:Name="Border">
                                <ContentPresenter x:Name="ContentSite" VerticalAlignment="Center" HorizontalAlignment="Center"  ContentSource="Header" Margin="12,2,12,2"/>
                            </Border>
                        </Grid>
                        <ControlTemplate.Triggers>
                            <Trigger Property="IsSelected" Value="True">
                                <Setter TargetName="Border" Property="Background" Value="#a7a5a5" />
                                <Setter TargetName="Border" Property="BorderBrush" Value="#a7a5a5" />

                            </Trigger>
                            <Trigger Property="IsSelected" Value="False">
                                <Setter TargetName="Border" Property="Background" Value="#FF515454" />
                                <Setter TargetName="Border" Property="BorderBrush" Value="#FF515454" />
                            </Trigger>
                            <Trigger Property="IsSelected" Value="False">
                                <Setter Property="Foreground" Value="White"/>
                            </Trigger>
                        </ControlTemplate.Triggers>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>

    </Window.Resources>

    <Grid>
        <Rectangle Height="100"  x:Name="rectangle1"  VerticalAlignment="Top" Fill="#FF515454" Stroke="#FF515454" SnapsToDevicePixels="False" Margin="0,-1,0,0" />
        <Image Height="100" HorizontalAlignment="Left" Margin="0,-2,0,0" x:Name="image1" Stretch="Uniform" VerticalAlignment="Top" Width="250" Source="..\Graphics\Banner.png"/>
        <Label Content="Compras" Height="43" HorizontalAlignment="Left" Margin="41,107.5,0,0" x:Name="label1" VerticalAlignment="Top" FontFamily="../Fonts/GeosansLight.ttf#GeosansLight" Width="261" FontSize="30" Foreground="#FF0384C5" />
        <TabControl Margin="41,154.5,41,25" Background="#FFA7A5A5" BorderBrush="{x:Null}">
            <TabItem Header="Documentos Pendientes" FontSize="18.667" FontFamily="/LASDesktop;component/Fonts/#GeosansLight"  d:LayoutOverrides="HorizontalAlignment">
                <Grid>
            		<Grid x:Name="Documento" Visibility="Hidden">
                        <ComboBox x:Name="ProveedorComboBox" HorizontalAlignment="Left" Margin="116,8,0,0" VerticalAlignment="Top" Width="251" Height="25.14" FontFamily="Segoe UI" FontSize="13.333" SelectionChanged="ProveedorComboBox_SelectionChanged" DisplayMemberPath="CodigoSocios"  />
            			<Label Content="Proveedor:" Margin="24,6,0,0" VerticalAlignment="Top" Height="25.14" FontSize="16" FontFamily="Calibri" HorizontalAlignment="Left" Width="92"/>
            			<Label Content="Fecha de Contabilización:" HorizontalAlignment="Right" Margin="0,12.427,219,0" VerticalAlignment="Top" Width="180" Height="25.14" FontSize="16" FontFamily="Calibri"/>
            			<Label x:Name="TextFecha" Content="Fecha de Entrega:" HorizontalAlignment="Right" Margin="0,41.426,219,0" Width="180" FontSize="16" FontFamily="Calibri" Height="29.14" VerticalAlignment="Top"/>
            			<TextBox x:Name="NombreTextBox" HorizontalAlignment="Left" Margin="116,37.14,0,0" TextWrapping="Wrap" Text="&#xa;" Width="251" FontFamily="Segoe UI" FontSize="13.333" Height="21" VerticalAlignment="Top" IsEnabled="False"/>
            			<Label Content="Nombre:" Margin="24,33.14,0,0" FontSize="16" FontFamily="Calibri" HorizontalAlignment="Left" Height="25.14" VerticalAlignment="Top" Width="70"/>
                        <ComboBox x:Name="MonedaComboBox" HorizontalAlignment="Left" Margin="116,64.28,0,0" VerticalAlignment="Top" Width="149" Height="25.14" FontFamily="Segoe UI" FontSize="13.333" DisplayMemberPath="NombreMoneda"/>
            			<Label Content="Moneda:" Margin="24,62.28,0,0" VerticalAlignment="Top" Height="25.14" FontSize="16" FontFamily="Calibri" HorizontalAlignment="Left" Width="92"/>
                    
            			<Button x:Name="AceptarButton" Content="Aceptar" HorizontalAlignment="Right" Height="15" Margin="0,0,21,8" VerticalAlignment="Bottom" Width="129" FontFamily="Segoe UI" FontSize="13.333" Foreground="White" Click="AcceptDocumentClick"/>
            			<Button x:Name="CancelarButton" Content="Cancelar" HorizontalAlignment="Right" Height="23" Margin="0,0,160,8" VerticalAlignment="Bottom" Width="132" FontFamily="Segoe UI" FontSize="13.333" IsCancel="True" Foreground="White" Click="CancelDocumentClick"/>
            			<TextBox x:Name="TotalAntesImpuestoTextbox" HorizontalAlignment="Right" Height="21" Margin="0,0,21,116.153" TextWrapping="Wrap" VerticalAlignment="Bottom" Width="180" FontFamily="Segoe UI" FontSize="13.333" TextAlignment="Right" IsReadOnly="True"/>
            			<Label Content="Total antes de Impuesto&#xa;" HorizontalAlignment="Right" Margin="0,0,202,112.013" VerticalAlignment="Bottom" Width="180" Height="27.987" FontSize="16" FontFamily="Calibri"/>
            			<TextBox x:Name="ImpuestoTextBox" HorizontalAlignment="Right" Height="21" Margin="0,0,21,89.013" TextWrapping="Wrap" VerticalAlignment="Bottom" Width="180" FontFamily="Segoe UI" FontSize="13.333" TextAlignment="Right" IsReadOnly="True"/>
            			<Label Content="Impuesto" HorizontalAlignment="Right" Margin="0,0,202,81.72" VerticalAlignment="Bottom" Width="180" Height="33.14" FontSize="16" FontFamily="Calibri"/>
            			<TextBox x:Name="TotalTextBox" HorizontalAlignment="Right" Height="21" Margin="0,0,21,62.166" TextWrapping="Wrap" VerticalAlignment="Bottom" Width="180" FontFamily="Segoe UI" FontSize="13.333" TextAlignment="Right" IsReadOnly="True"/>
            			<Label Content="Total" HorizontalAlignment="Right" Margin="0,0,202,61.873" VerticalAlignment="Bottom" Width="180" Height="25.14" FontSize="16" FontFamily="Calibri"/>
            			<Label Content="Empleado:" Margin="24,0,0,103.013" VerticalAlignment="Bottom" Height="34.14" FontSize="16" FontFamily="Calibri" HorizontalAlignment="Left" Width="82"/>
            			<ComboBox x:Name="EmpleadoComboBox" HorizontalAlignment="Left" Margin="110,0,0,112.013" VerticalAlignment="Bottom" Width="232" Height="25.14" FontFamily="Segoe UI" FontSize="13.333"/>
                        <ComboBox x:Name="TransformToComboBox" SelectedIndex="0" Margin="463,0,304,8" VerticalAlignment="Bottom" Height="23" FontFamily="Segoe UI" FontSize="13.333"></ComboBox>
            			<DatePicker x:Name="FechaContabilizacionDatePicker" HorizontalAlignment="Right" Margin="0,14.273,21,0" VerticalAlignment="Top" FontFamily="Segoe UI" FontSize="13.333" Width="198" BorderThickness="0"/>
            			<DatePicker x:Name="FechaEntregaDatePicker" HorizontalAlignment="Right" Margin="0,43.273,21,0" FontFamily="Segoe UI" FontSize="13.333" Width="198" BorderThickness="0" VerticalAlignment="Top"/>
            			<DataGrid x:Name="GridArticulos"  AutoGenerateColumns="False" Height="179.86" HorizontalAlignment="Left" Margin="24,102.64,0,0" VerticalAlignment="Top" Width="894" FontFamily="Calibri" FontSize="15" BorderBrush="{x:Null}" Background="#FFDEDEDE" HorizontalGridLinesBrush="#FFBCBCBC" VerticalGridLinesBrush="#FFBCBCBC" RowBackground="#FFDEDEDE" CanUserAddRows="False" SelectionUnit="FullRow" SelectedIndex="0">
                   
            				<DataGrid.Columns>
            					<DataGridTextColumn Header="#"/>
                            
            					<DataGridTemplateColumn Width="150" Header="Código del Artículo">
            						<DataGridTemplateColumn.CellTemplate>
            							<DataTemplate>
            								<Grid>
            									<ComboBox x:Name="ComboBoxArticulos" ItemsSource="{Binding ComboArticulos}" DisplayMemberPath="CodigoUnico"  SelectionChanged="ComboBoxArticulosSelectionChanged" SelectedItem="{Binding ArticuloNuevo}" />
            								</Grid>
            							</DataTemplate>
            						</DataGridTemplateColumn.CellTemplate>
            					</DataGridTemplateColumn>

            					<DataGridTemplateColumn Width="200" Header="Descripción">
            						<DataGridTemplateColumn.CellTemplate>
            							<DataTemplate>
            								<Grid>
            									<TextBlock Text="{Binding ArticuloNuevo.Descripcion}" HorizontalAlignment="Center" VerticalAlignment="Center"/>
            								</Grid>
            							</DataTemplate>
            						</DataGridTemplateColumn.CellTemplate>
            					</DataGridTemplateColumn>

            					<DataGridTemplateColumn Width="85" Header="Cantidad">
            						<DataGridTemplateColumn.CellTemplate>
            							<DataTemplate>
            								<Grid>
            									<TextBox  Text="{Binding Cantidad}" Width="85" HorizontalAlignment="Center" VerticalAlignment="Center" LostFocus="TextboxCantidadChanged" />
            								</Grid>
            							</DataTemplate>
            						</DataGridTemplateColumn.CellTemplate>
            					</DataGridTemplateColumn>

            					<DataGridTemplateColumn Width="120" Header="Precio de compra">
            						<DataGridTemplateColumn.CellTemplate>
            							<DataTemplate>
            								<Grid>
            									<TextBox Text="{Binding PrecioDeCompra}" Width="120" HorizontalAlignment="Center" VerticalAlignment="Center" LostFocus="TextboxPrecioCompraChanged"/>
            								</Grid>
            							</DataTemplate>
            						</DataGridTemplateColumn.CellTemplate>
            					</DataGridTemplateColumn>

            					<DataGridTemplateColumn Width="110" Header="% de Impuestos">
            						<DataGridTemplateColumn.CellTemplate>
            							<DataTemplate>
            								<Grid>
            									<TextBox Text="{Binding Impuesto}" Width="110" HorizontalAlignment="Center" VerticalAlignment="Center" LostFocus="TextboxImpuestoSelectionChanged"/>
            								</Grid>
            							</DataTemplate>
            						</DataGridTemplateColumn.CellTemplate>
            					</DataGridTemplateColumn>

            					<DataGridTemplateColumn Width="100" Header="Total">
            						<DataGridTemplateColumn.CellTemplate>
            							<DataTemplate>
            								<Grid>
            									<TextBlock Text="{Binding Total}" HorizontalAlignment="Center" VerticalAlignment="Center"/>
            								</Grid>
            							</DataTemplate>
            						</DataGridTemplateColumn.CellTemplate>
            					</DataGridTemplateColumn>

            					<DataGridTemplateColumn Width="75" Header="Bodegas">
            						<DataGridTemplateColumn.CellTemplate>
            							<DataTemplate>
            								<Grid>
            									<ComboBox x:Name="BodegaComboBox" ItemsSource="{Binding ComboBodegas}" DisplayMemberPath="NombreBodega" SelectionChanged="ComboBoxBodegasSelectionChanged" SelectedItem="{Binding BodegaFinal}" />
            								</Grid>
            							</DataTemplate>
            						</DataGridTemplateColumn.CellTemplate>
            					</DataGridTemplateColumn>
							
            					<DataGridTemplateColumn Width="25">
            						<DataGridTemplateColumn.CellTemplate>
            							<DataTemplate>
            								<Grid>
            									<Image HorizontalAlignment="Left" Height="20" Source="/LASDesktop;component/Graphics/Exit.png" Stretch="Fill" VerticalAlignment="Bottom" Width="20" Opacity="0.65" MouseUp="DeleteButtonClicked"/>
            								</Grid>
            							</DataTemplate>
            						</DataGridTemplateColumn.CellTemplate>
            					</DataGridTemplateColumn>
            				</DataGrid.Columns>
            			</DataGrid>
            		</Grid>
            		<Grid x:Name="Pendientes">
            			<DataGrid x:Name="GridPendientes"  AutoGenerateColumns="False" Height="339.86" HorizontalAlignment="Left" Margin="30,79.64,0,0" VerticalAlignment="Top" Width="881" FontFamily="Calibri" FontSize="15" BorderBrush="{x:Null}" Background="#FFDEDEDE" HorizontalGridLinesBrush="#FFBCBCBC" VerticalGridLinesBrush="#FFBCBCBC" RowBackground="#FFDEDEDE" CanUserAddRows="False">
                   
            				<DataGrid.Columns>

            					<DataGridTemplateColumn Width="170" Header="Código de Documento" IsReadOnly="True">
            						<DataGridTemplateColumn.CellTemplate>
            							<DataTemplate>
            								<Grid Width="155" Height="40">
            									<TextBlock Text="{Binding CodigoUnico}" HorizontalAlignment="Center" VerticalAlignment="Center"/>
            								</Grid>
            							</DataTemplate>
            						</DataGridTemplateColumn.CellTemplate>
            					</DataGridTemplateColumn>
							
            					<DataGridTemplateColumn Width="200" Header="Nombre del Proveedor" IsReadOnly="True">
            						<DataGridTemplateColumn.CellTemplate>
            							<DataTemplate>
            								<Grid Width="200" Height="40">
                                                <TextBlock Text="{Binding DatosDocumentos.Socio.Nombre}" HorizontalAlignment="Center" VerticalAlignment="Center" TextWrapping="Wrap" />
            								</Grid>
            							</DataTemplate>
            						</DataGridTemplateColumn.CellTemplate>
            					</DataGridTemplateColumn>
								
								<DataGridTemplateColumn Width="170" Header="Fecha de Contabilización" IsReadOnly="True">
            						<DataGridTemplateColumn.CellTemplate>
            							<DataTemplate>
            								<Grid Width="155" Height="40">
                                                <TextBlock Text="{Binding DatosDocumentos.FechaContabilizacion}" HorizontalAlignment="Center" VerticalAlignment="Center"/>
            								</Grid>
            							</DataTemplate>
            						</DataGridTemplateColumn.CellTemplate>
            					</DataGridTemplateColumn>
								
								<DataGridTemplateColumn Width="170" Header="Fecha de Entrega" IsReadOnly="True">
            						<DataGridTemplateColumn.CellTemplate>
            							<DataTemplate>
            								<Grid Width="155" Height="40">
                                                <TextBlock Text="{Binding DatosDocumentos.FechaEntrega}" HorizontalAlignment="Center" VerticalAlignment="Center"/>
            								</Grid>
            							</DataTemplate>
            						</DataGridTemplateColumn.CellTemplate>
            					</DataGridTemplateColumn>
						   
            					<DataGridTemplateColumn Width="150" IsReadOnly="True">
            						<DataGridTemplateColumn.CellTemplate>
            							<DataTemplate>
            								<Grid Width="150" Height="30">
            									<TextBlock Text="Detalle de Documento" HorizontalAlignment="Center" Height="18.78" VerticalAlignment="Center" Width="150" FontFamily="Calibri" FontSize="15" TextDecorations="Underline" Foreground="#FF0384C5" Cursor="Hand" MouseUp="VerDetallesButtonClick"/>
            								</Grid>
            							</DataTemplate>
            						</DataGridTemplateColumn.CellTemplate>
            					</DataGridTemplateColumn>

            				</DataGrid.Columns>
            			</DataGrid>
            			<Label Content="Por favor seleccione un tipo de documento." Height="34" Margin="30,25,0,0" VerticalAlignment="Top" HorizontalAlignment="Left" Width="334" FontFamily="Calibri" FontSize="16"/>
            			<TextBlock Text="Crear nuevo documento" HorizontalAlignment="Right" Height="18.78" VerticalAlignment="Top" Width="152" FontFamily="Calibri" FontSize="15" TextDecorations="Underline" Foreground="#FF095880" Cursor="Hand" MouseUp="NuevoDocumentoButtonClick" Margin="0,30.667,247.5,0"/>
						<ComboBox x:Name="InputTipoDeDocumento" Margin="359,28,417,0" VerticalAlignment="Top" FontFamily="Calibri" SelectionChanged="DocumentTypeComboChanged" FontSize="16" Height="25.53">
							<ComboBoxItem Content="Orden de Compra" FontFamily="Segoe UI" FontSize="12"/>
							<ComboBoxItem Content="Entrada de Mercancias" FontFamily="Segoe UI" FontSize="12"/>
							<ComboBoxItem Content="Factura de Proveedores" FontFamily="Segoe UI" FontSize="12"/>
						</ComboBox>
            		</Grid>    
            	</Grid>
            </TabItem>
					  <TabItem Header="Saldo de Proveedores" FontSize="18.667" FontFamily="/LASDesktop;component/Fonts/#GeosansLight"  d:LayoutOverrides="HorizontalAlignment">
                <Grid/>
            </TabItem>
        </TabControl>

        <Rectangle x:Name="Overlay" Fill="#AC161616" Margin="0,-2,0,0" Visibility="Hidden"/>
        <Grid Height="100" VerticalAlignment="Top" Margin="317,-2,8,0">
        	<Label Content="Inventario" Margin="0,23.5,0,27" x:Name="label1_Copy" FontFamily="../Fonts/GeosansLight.ttf#GeosansLight" FontSize="37.333" Foreground="#FFDEDEDE" HorizontalAlignment="Left" Width="159" Cursor="Hand" MouseDown="ChangeWindow" />
        	<Label Content="Socios" Margin="0,23.5,154,27" x:Name="label1_Copy1" FontFamily="../Fonts/GeosansLight.ttf#GeosansLight" FontSize="37.333" Foreground="#FFDEDEDE" HorizontalAlignment="Right" Width="114" Cursor="Hand" MouseDown="ChangeWindow" />
        	<Label Content="Compras" Margin="282,23.5,268,27" x:Name="label1_Copy2" FontFamily="../Fonts/GeosansLight.ttf#GeosansLight" FontSize="37.333" Foreground="#FFDEDEDE" Cursor="Hand" MouseDown="ChangeWindow" />
        	<Label Content="Ventas" Margin="163,23.5,0,27" x:Name="label1_Copy3" FontFamily="../Fonts/GeosansLight.ttf#GeosansLight" FontSize="37.333" Foreground="#FFDEDEDE" HorizontalAlignment="Left" Width="115" Cursor="Hand" MouseDown="ChangeWindow" />
        	<Label Content="Bancos" Margin="0,23.5,28,27" x:Name="label1_Copy4" FontFamily="../Fonts/GeosansLight.ttf#GeosansLight" FontSize="37.333" Foreground="#FFDEDEDE" HorizontalAlignment="Right" Width="122" Cursor="Hand" MouseDown="ChangeWindow" />
        </Grid>

    </Grid>
</Window>
